package com.siwei.mes.entity.erp;

import com.alibaba.fastjson.JSONObject;
import com.siwei.mes.common.util.JsonUtils;
import com.siwei.mes.common.validator.AddGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;

/**
 * @Description: 细骨料-表观密度
 * @Version: 1.0
 * @author: YANGKE
 * @date: 2024/02/25 21:29
 */
@Data
@Accessors(chain = true)
public class ProjectMaterialsReport {
    @ApiModelProperty(value = "水泥报告信息")
    private ProjectMaterialsReport.MaterialsInfo sn = new ProjectMaterialsReport.MaterialsInfo();
    @ApiModelProperty(value = "矿渣粉报告信息")
    private ProjectMaterialsReport.MaterialsInfo kzf = new ProjectMaterialsReport.MaterialsInfo();
    @ApiModelProperty(value = "粉煤灰报告信息")
    private ProjectMaterialsReport.MaterialsInfo fmh = new ProjectMaterialsReport.MaterialsInfo();
    @ApiModelProperty(value = "细骨料报告信息")
    private ProjectMaterialsReport.MaterialsInfo xgl = new ProjectMaterialsReport.MaterialsInfo();
    @ApiModelProperty(value = "粗骨料报告信息")
    private ProjectMaterialsReport.MaterialsInfo cgl = new ProjectMaterialsReport.MaterialsInfo();
    @ApiModelProperty(value = "外加剂1报告信息")
    private ProjectMaterialsReport.MaterialsInfo wjj1 = new ProjectMaterialsReport.MaterialsInfo();
    @ApiModelProperty(value = "外加剂2报告信息")
    private ProjectMaterialsReport.MaterialsInfo wjj2 = new ProjectMaterialsReport.MaterialsInfo();
    @ApiModelProperty(value = "外掺料1报告信息")
    private ProjectMaterialsReport.MaterialsInfo wcl1 = new ProjectMaterialsReport.MaterialsInfo();
    @ApiModelProperty(value = "外掺料2报告信息")
    private ProjectMaterialsReport.MaterialsInfo wcl2 = new ProjectMaterialsReport.MaterialsInfo();

    @Data
    @Accessors(chain = true)
    @ApiModel("报告信息")
    public static class MaterialsInfo {
        @ApiModelProperty(value = "材料名称")
        private String clmc = "";
        @ApiModelProperty(value = "材料类型")
        private String cllx = "";
        @ApiModelProperty(value = "材料规格")
        private String clgg = "";
        @ApiModelProperty(value = "物料名称")
        private String wlmc = "";
        @ApiModelProperty(value = "物料类型")
        private String wllx = "";
        @ApiModelProperty(value = "物料规格")
        private String wlgg = "";
        @ApiModelProperty(value = "厂家")
        private String cj = "";
        @ApiModelProperty(value = "厂家简称")
        private String cjjc = "";
        @ApiModelProperty(value = "供应商")
        private String gys = "";
        @ApiModelProperty(value = "供应商简称")
        private String gysjc = "";
    }

    /**
     * 字符串转成对象 然后再转成json
     *
     * @param object
     * @return
     */
    private static JSONObject toJsonObject(Object object) {
        ProjectMaterialsReport entity = new ProjectMaterialsReport();
        if (object == null) {
            return JsonUtils.beanToObject(entity);
        }
        if (object instanceof String) {
            entity = JsonUtils.getObject((String) object, ProjectMaterialsReport.class);
        } else if (object instanceof JSONObject) {
            entity = JsonUtils.getObject((JSONObject) object, ProjectMaterialsReport.class);
        }
        return JsonUtils.beanToObject(entity);
    }

}
